<template>
  <div class="notice" :style="{'min-height':bodyHeight+'px'}">
    <x-header :left-options="{backText: ''}">通知</x-header>
    <div style="margin-top:10px;border-top:1px solid #f6f6f6">
      <ul>
        <li class="noticeList" v-for="listName in list" @click="noticeBtn(listName._id)">
          <span class="listTitle">{{listName.title}}</span>
          <img src="../../assets/nav.png" alt="" width="10">
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
  import { XHeader } from 'vux'
  import http from '../../service/http.js'
  export default {
    data() {
      return {
        list: [],
        bodyHeight:""
      }
    },
    mounted() {
      this.bodyHeight = document.documentElement.clientHeight
      this.getList();
    },
    methods: {
      getList() {
         http.get("/home/notices").then((res)=>{
            if(res.status==200){
              this.list=res.data.body;
            }
         })
      },
      noticeBtn(id){
        this.$router.push({path:"/main/noticeSecond?id="+id})
      }
    },
    components: {
      XHeader,
    }
  }
</script>
<style lang="less">
  .notice{
    background: #f6f6f6;
  }
  .notice .vux-header {
    background: #fff;
  }

  .notice .vux-header .vux-header-title {
    line-height: 40px;
    text-align: center;
    font-size: 18px;
    font-weight: 400;
    color: #000;
  }

  .noticeList {
    border-bottom: 1px solid #f6f6f6;
    height: 40px;
    line-height: 40px;
    padding: 0px 15px;
    position: relative;
    img {
      position: absolute;
      right: 15px;
      top: 10px;
    }
  }

  .notice .vux-header .vux-header-left .left-arrow:before {
    content: "";
    position: absolute;
    width: 12px;
    height: 12px;
    border: 1px solid #000;
    border-width: 1px 0 0 1px;
    -webkit-transform: rotate(315deg);
    transform: rotate(315deg);
    top: 8px;
    left: 7px;
  }
  .listTitle{
    overflow:hidden;
    text-overflow:ellipsis;
    white-space:nowrap;
    width: 90%;
    display: inline-block;
  }
</style>